// async_iterator_demo.js
// node async_iterator_demo.js
// npx babel-node async_iterator_demo.js

let _ = '';
const {log} = console;

const test1 = function(){
    const idMaker = function(){
        let index = 0;

        return {
            next: function(){
                return {
                    value: new Promise(resolve => setTimeout(() => resolve(index++), 1000)),
                    done: false
                };
            }
        };
    };

    const it = idMaker();

    it.next().value.then(x => log(x));
    it.next().value.then(x => log(x));
    it.next().value.then(x => log(x));
    it.next().value.then(x => log(x));
    it.next().value.then(x => log(x));
};
// test1();





